<?php
/**
 * Created by PhpStorm.
 * User: 69548
 * Date: 2018/7/23
 * Time: 17:50
 */

namespace app\api\controller;


use app\common\controller\Api;

class Theme extends Api
{

    public function _initialize()
    {
        header('Access-Control-Allow-Origin:*');
    }


    //获取tag列表
    public function getList()
    {
        $themeData = db("theme")
            ->alias('t')
            ->join('attachment a' ,'t.thumb=a.id',"left")
            ->where("t.status",1)
            ->field("t.*,a.filepath")
            ->order("t.sortNum desc")
            ->select();

        if (!empty($themeData)){
            $shu=[
                'code'=>0,
                'msg'=>'请求成功',
                'data'=>$themeData
            ];
        }else{
            $shu=[
                'code'=>0,
                'msg'=>'请求失败',
                'data'=>[]
            ];
        }

        return json_encode($shu);
    }











}